<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page import="com.diligreat.cache.Cache,java.util.HashMap,java.util.*,com.diligreat.domain.Lang" %>
<style>
#langchoosing{position:relative;}
#langchoosing .lc{position:absolute;width:200px;right:20px;top:20px;overflow:hidden;display:none;}
#langchoosing .lc .each{width:200px}
#langchoosing .lc .each .left{float:left}
#langchoosing .lc .each .right{float:left}
#langchoosing .lc .each .right div{float:left;cursor:pointer}
#langchoosing .lc .each .right .len{float:left}
</style>
<script type="text/javascript">
$(document).ready(function(){
	$('#langchoosing .lang').toggle(
		function() {
			$('#langchoosing .lc').show();
		}, 
		function() {
			$('#langchoosing .lc').hide();
	});
	
	
	$('#langchoosing .lc .each .right div').not('.len').click(function(){
		$('#hs').val($(this).attr('class'));
		$('#changelang').submit();
	});
});
</script>
<div id="langchoosing">
	<div class="lang">China<img src="images/flag/china.jpg"/><img src="images/ico/choosing.jpg"/></div>
	<div class="lc">
		<%
			List<Lang> area=Cache.getCache().getArea();
			for(int i=0;i<area.size();i++)
			{
				Lang langarea=area.get(i);
				out.println("<div class=\"each\">");
				out.println("<div class=\"left\"><img src=\"images/flag/"+langarea.getFl()+"\"/>"+langarea.getName()+"-</div>");
				out.println("<div class=\"right\">");
				for(int j=0;j<langarea.getUnderlist().size();j++)
				{
					Lang langsub=langarea.getUnderlist().get(j);
					if(j==(langarea.getUnderlist().size()-1))
					{
						out.println("<div class=\""+langsub.getId()+"\">"+langsub.getName()+"</div>");
					}
					else
					{
						out.println("<div class=\""+langsub.getId()+"\">"+langsub.getName()+"</div><div class=\"len\">|</div>");
					}
					
				}
				out.println("</div>");
				out.println("</div>");
			}
		%>
	</div>
	<form id="changelang" action="${basePath}index.htm" method="get">
		<input id="hs" value="1" type="hidden" name="language"/>
	</form>
</div>
